<!--  -->
<template>
  <div class="home-nav">
    <div class="nav-box" v-for="item in channel" :key="item.id" @click="toChannel(item.id)">
      <img :src="item.icon_url" alt="">
      <span>{{item.name}}</span>
    </div>
  </div>
</template>

<script>
import {defineComponent, setup} from 'vue'
import {useRouter} from 'vue-router'
export default defineComponent({
  name: 'HomeNav',
  props: {
    channel: {
      type: Array,
      default() {
        return []
      }
    }
  },
  setup() {
    const router = useRouter()
    const toChannel = (id) => {
      router.push({
        path: '/channel',
        query: {
          id
        }
      })
    }
    return {
      toChannel
    }
  }
})
</script>

<style lang="scss" scoped>
  .home-nav {
    width: 100%;
    height: 172px;
    background-color: white;
    /* margin-top: 0; */
    display: flex;
  }
  .nav-box {
    flex-basis: 20%;
    height: 100%;
    display: flex;
    flex-flow: column;
    align-items: center;
    justify-content: center;
    /* border-left: 0.1px solid #646566; */
  }
  img {
    display: block;
    width: 56px;
    height: 56px;
  }
  span {
    font-size: 24px;
    margin-top: 20px;
    color: #646566;
  }
</style>